libxl: set guest_domid even if libxl__domain_make fails
authorRoger Pau Monne <roger.pau@citrix.com>
Fri, 11 May 2012 17:59:03 +0000 (18:59 +0100)
committerRoger Pau Monne <roger.pau@citrix.com>
Fri, 11 May 2012 17:59:03 +0000 (18:59 +0100)
This is needed in order to perform the domain destruction if
libxl__domain_make fails.

Also move doc comment about error behaviour of libxl__domain_make from
implementation to declaration.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/libxl/libxl_create.c
tools/libxl/libxl_internal.h

index 9ce107a68954db34ee4aa5ad041a4f407424871c..50755379fa316f6a4e4966a41023518a6ff5429c 100644 (file)
@@ -396,8 +396,6 @@ out:
 
 int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info,
                        uint32_t *domid)
- /* on entry, libxl_domid_valid_guest(domid) must be false;
-  * on exit (even error exit), domid may be valid and refer to a domain */
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int flags, ret, rc;
@@ -600,6 +598,7 @@ static void initiate_domain_create(libxl__egc *egc,
     ret = libxl__domain_make(gc, &d_config->c_info, &domid);
     if (ret) {
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot make domain: %d", ret);
+        dcs->guest_domid = domid;
         ret = ERROR_FAIL;
         goto error_out;
     }
index dc848814381f762f614d245264d671dbdb3fcebd..b1ce4d612e878e7a578d01e41d7e02d61073e56b 100644 (file)
@@ -1078,9 +1078,13 @@ _hidden void libxl__exec(int stdinfd, int stdoutfd, int stderrfd,
                const char *arg0, char **args); // logs errors, never returns
 
 /* from xl_create */
+
+ /* on entry, libxl_domid_valid_guest(domid) must be false;
+  * on exit (even error exit), domid may be valid and refer to a domain */
 _hidden int libxl__domain_make(libxl__gc *gc,
                                libxl_domain_create_info *info,
                                uint32_t *domid);
+
 _hidden int libxl__domain_build(libxl__gc *gc,
                                 libxl_domain_build_info *info,
                                 uint32_t domid,